package com.luofan.mapper;

import com.luofan.entity.po.Term;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.time.Year;

/**
 * <p>
 * 学期表 Mapper 接口
 * </p>
 *
 * @author 
 * @since 2025-03-26
 */
@Mapper
public interface TermMapper extends BaseMapper<Term> {

    //查询学期是否存在
    int selectTermByYearAndSemester(@Param("year") Year year, @Param("semester") Integer semester);

//    创建新学期信息
    int createTerm(Term term);

    //修改学期的开始时间和结束时间
    void updateTerm(Term term);

    //根据当前时间获取当前学期信息
    Term getTermIdByTime(@Param("now") LocalDateTime now);
}
